﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ASCII_operations
{
    class Program
    {

        
        static void Main(string[] args)
        {
            ASCII Map2009 = new ASCII("C:\\Users\\adebruij\\Desktop\\Malinau Simulations\\LUCMatrix\\input\\malinau2009.asc");
            ASCII Map2000 = new ASCII("C:\\Users\\adebruij\\Desktop\\Malinau Simulations\\LUCMatrix\\input\\malinau2000.asc");
           


            int[,] Transitions = new int[10,10];

            for (int r = 0; r < Map2000.Nrows; r++)
            {
                for (int c = 0; c < Map2000.Ncols ; c++)
                {
                    int from = Map2000[r, c];
                    int to = Map2009[r, c];

                    if (from == -9999) from = 9;
                    if (to == -9999) to = 9;

                    Transitions[from, to]++;
                }
            }

            double t = 0.0;
            List<string> outputfilecontent = new List<string>();

            for (int r = 0; r < 10; r++)
            {
                string l = "";
                for (int c = 0; c < 10; c++)
                {
                    l += Transitions[r, c] + "\t";
                }
                outputfilecontent.Add(l);
            }
            System.IO.File.WriteAllLines("C:\\Users\\adebruij\\Desktop\\Malinau Simulations\\LUCMatrix\\input\\output.txt", outputfilecontent.ToArray());
        }
    }
}
